package com.example.lotterysystem.common.exception;

import com.example.lotterysystem.common.enums.GlobalErrorCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class GlobalException extends RuntimeException{
    private Integer code;
    private String message;
    private String errorCause;

    public GlobalException(){

    }

    public GlobalException(Integer code, String msg){
        this.code = code;
        this.message = msg;
    }

    public GlobalException(GlobalErrorCodeEnum errorCode){
        this.code = errorCode.getCode();
        this.message = errorCode.getMsg();
    }

    public GlobalException(GlobalErrorCodeEnum errorCode, String errorCause){
        this.code = errorCode.getCode();
        this.message = errorCode.getMsg();
        this.errorCause = errorCause;
    }

    public GlobalException(String errorCause){
        this.errorCause = errorCause;
    }
}
